package cn.fl.capital.transform;


import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.capital.dto.CapRepaymentDTO;
import cn.fl.capital.vo.CapRepaymentVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:  资管账单 转换器
 * VO是客户端传递数据到服务端进行转换的数据
 * VO转换数据变成DTO传递到服务端
 * VO不能在服务端出现
 */
public class CapRepaymentVOTransform {

    /**
     * DTO 转  VO
     * @param dto CapRepaymentDTO
     * @return CapRepaymentVO
     */
    public static CapRepaymentVO toVO(CapRepaymentDTO dto) {
        CapRepaymentVO vo = null;
        if (dto != null) {
            vo=new CapRepaymentVO();
            vo.setId(dto.getId());
            vo.setBeginRentTime(dto.getBeginRentTime());
            vo.setCstId(dto.getCstId());
            vo.setCstNm(dto.getCstNm());
            vo.setFoundInsCode(dto.getFoundInsCode());
            vo.setFoundInsName(dto.getFoundInsName());
            vo.setPaySchId(dto.getPaySchId());
            vo.setPaySchNo(dto.getPaySchNo());
            vo.setReceivableTtlAmt(dto.getReceivableTtlAmt());
            vo.setReceivedTtlAmt(dto.getReceivedTtlAmt());
            vo.setReceivedIntereAmt(dto.getReceivedIntereAmt());
            vo.setPayPd(dto.getPayPd());
            vo.setPayDt(dto.getPayDt());
        }
        return vo;
    }

    public static CapRepaymentDTO  toDTO(CapRepaymentVO vo){
        CapRepaymentDTO dto=null;
        if(dto != null){
            dto=new CapRepaymentDTO();
            dto.setId(vo.getId());
            dto.setBeginRentTime(vo.getBeginRentTime());
            dto.setCstId(vo.getCstId());
            dto.setCstNm(vo.getCstNm());
            dto.setFoundInsCode(vo.getFoundInsCode());
            dto.setFoundInsName(vo.getFoundInsName());
            dto.setPaySchId(vo.getPaySchId());
            dto.setPaySchNo(vo.getPaySchNo());
            dto.setReceivableTtlAmt(vo.getReceivableTtlAmt());
            dto.setReceivedTtlAmt(vo.getReceivedTtlAmt());
            dto.setReceivedIntereAmt(vo.getReceivedIntereAmt());
            dto.setPayPd(vo.getPayPd());
            dto.setPayDt(vo.getPayDt());

        }
        return dto;
    }

    /**
     * DTO集合 转 VO集合
     * @param list List<CapRepaymentDTO>
     * @return List<CapRepaymentVO>
     */
    public static List<CapRepaymentVO> toVOList(List<CapRepaymentDTO> list) {
        List<CapRepaymentVO>  voList = new ArrayList<CapRepaymentVO>();
        if(CollectionUtils.isNotEmpty(list)){
            for (CapRepaymentDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }

    /**
     *  VO集合 转 DTO集合
     * @param list List<CapRepaymentVO>
     * @return List<CapRepaymentDTO>
     */
    public static List<CapRepaymentDTO> toDTOList(List<CapRepaymentVO> list) {
        List<CapRepaymentDTO>  dtoList = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(list)){
            for (CapRepaymentVO vo : list) {
                dtoList.add(toDTO(vo));
            }
        }
        return dtoList;
    }

}
